package com.press.services;

import com.press.bean.UserBean;
import com.press.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by haocongshun on 2016/10/14.
 */
@Service("userService")
public class UserService {
    @Resource(name = "userMapper")
    private UserMapper userMapper;

    public UserMapper getUserMapper() {
        return userMapper;
    }

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public List<UserBean> getUserInfo(){
        return userMapper.getUserInfo();
    }
    public boolean addUser(UserBean newUser){

        return userMapper.addUser(newUser);
    }
    public String getUserPk(){
        return String.valueOf(Integer.parseInt(userMapper.getUserPk())+1);
    }
    public boolean checkUser(String user_username){
        if(userMapper.checkUser(user_username)>0){
            return true;
        }else {
            return false;
        }
    }
    public boolean freezeUser(String user_id){
        return userMapper.freezeUser(user_id);
    }
    public boolean unfreezeUser(String user_id){
        return userMapper.unfreezeUser(user_id);
    }
    public boolean deleteUser(String user_id){
        return userMapper.deleteUser(user_id);
    }
}
